﻿/*****************************************************************************
* File			: src.Explosion
* Purpose		: Contains Declaration and Implementation for Explosion class
* Creation date : April 26, 2009
* Author		: Sami TOUIL
******************************************************************************/
package src 
{
	// Imports
	import flash.display.MovieClip
	import flash.events.*
	
	/**************************************
	* Class		: Explosion
	* Purpose	: Logic for explosion behavior
	* Parent	: MovieClip
	**************************************/
	public class Explosion extends MovieClip
	{
		
		// Constructor
		public function Explosion(nX:int, nY:int)
		{
			// Set listener for ENTER_FRAME event
			addEventListener(Event.ENTER_FRAME, enterFrame);
			
			// Set coords
			x = nX;
			y = nY;
			
			Game.main.spriteClip.addChild(this);
		}
		
		/***********************************************************
		* Method		: enterFrame
		* Purpose		: frame loop
		* Parameters	: None
		* return		: void
		***********************************************************/
		public function enterFrame(e:Event)
		{
			// Just play animation once
			if(currentFrame == totalFrames)
			{
				removeEventListener(Event.ENTER_FRAME, enterFrame);
				Game.main.spriteClip.removeChild(this);
			}
		}
		
	}
}